package main

import (
	"bufio"
	"fmt"
	"os"
	"time"
)

func isId(id string) bool {
	if len(id) != 18 {
		return false
	}
	if id[0] != '4' {
		return false
	}
	for _, ch := range id {
		if ch < '0' || ch > '9' {
			return false
		}
	}
	return true
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	fmt.Print("请输入一个字符串: ")
	input_1, _ := reader.ReadString('\n')
	id := input_1[:len(input_1)-2]
	//id := "431224201805189999"
	if isId(id) {
		birth := id[6:14]
		birthDate, err := time.Parse("20060102", birth)
		if err != nil {
			fmt.Println("出生年月日出错")
			return
		}
		fmt.Println("出生年月日：", birthDate.Format("2006-01-02"))
		today := time.Now()
		age := today.Year() - birthDate.Year()
		if today.Month() < birthDate.Month() || (today.Month() == birthDate.Month() && today.Day() < birthDate.Day()) {
			age--
		}
		if age > 18 {
			fmt.Println("录取")
		} else {
			fmt.Println("劝退")
		}
	} else {
		fmt.Println("身份证号不合法")
	}
}
